<? include ("../init.php") ?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>

<?php
  $aid = $_GET['aid'];
  $sql = "SELECT * FROM hs_collection WHERE pc_id= '".$aid."'";
  $line = $db->queryUniqueObject($sql);
?>
<div id = "body">

<h1><?_l('Edit Collection')?></h1>
<div class = "clear"></div>


<form method="post" action="collection_update.php" class = "form">
  <input type="hidden" name="aid" value="<?php echo $aid; ?>" />
  <div class = "field"><label><?_l('collection')?></label><select name="collection"><option value="1" <?php if($line->pc_group==1){echo 'selected="selected"'; }?>>General collection</option><option value="2" <?php if($line->pc_group==2){echo 'selected="selected"'; }?>>New collection</option></select></div>
  <div class = "field"><label><?_l('name')?></label><input type = "text" name = "name" class = "input size1" value="<?php echo $line->pc_name; ?>"></div>
  <div class = "field"><label><?_l('slogan')?></label><input type = "text" name = "slogan" class = "input size2" value="<?php echo $line->pc_slogan; ?>"></div>
  <div class = "field"><label><?_l('detail')?></label><textarea name="detail" class="mceNoEditor"><?php echo $line->pc_detail; ?></textarea></div>
  <div class = "field"><label><?_l('active')?></label><input type = "checkbox" name = "active" value="1" <?php if($line->pc_active==1){echo 'checked="checked"'; }?>></div>
  <hr>
  <div class = "field"><label></label><input type = "submit" value = "<?=__l('update')?>" class = "btn">&nbsp;<a href = "#" class = "btn" onclick="javascript:history.back(1)"><?_l('cancel')?></a></div>
</form>


<table class ="list">
  <tr>
    <th scope="col"><?_l('product')?></th>
    <th scope="col"><?_l('category')?></th>
    <th scope="col" width = "120"><?_l('status')?></th>
    <th scope="col" width = "50"><?_l('edit')?></th>
    <th scope="col" width = "50"><?_l('delete')?></th>
  </tr>
<?
  $rss = $db->query("SELECT hs_product.*,hs_category.c_name FROM hs_product LEFT JOIN hs_category ON(hs_product.c_id=hs_category.c_id) WHERE hs_product.pc_id=$aid ORDER BY hs_product.p_name");
  while ($line = $db->fetchNextObject($rss)){
?>
  <tr>
    <td><?=$line->p_name?></td>
    <td><?php echo $line->c_name; ?></td>
    <td><?php if($line->p_active==1){ echo 'Active'; }else{ echo 'Unactive'; }?></td>
    <td><a href = "product_edit.php?aid=<?=$line->p_id?>" class = "btn"><?_l('edit')?></a></td>
    <td><a href = "product_delete.php?aid=<?=$line->p_id?>" class = "btn" onClick = "return confirmSubmit()"><?_l('delete')?></a></td>
  </tr>
<?
  }
?>
</table>

</div>

<style>
  .form label {
    width:80px;
  }
  .form textarea {
    width:618px;
    height:120px;
  }
</style>
</div>
<? include "../footer.php" ?>